
package com.starshineworks.util;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class MenuManager {
  
    public MenuManager() {        
    }
        
    public Menu buildMenu(List<String[]> list, Integer menuid, Integer numSel, String type) {
	Menu menu = new Menu(this, list.get(0)[2], numSel, type, menuid);
        for (Integer i = 1; i < list.size(); i++) {
            menu.addOption(i, list.get(i));
        }
        return menu;
    }   

    public Menu createRequestMenu(Integer menuid, Integer rowId, Map<String,String[]> m) {
        EntityFilter filt = new EntityFilter();
        
        Menu menu = null;
        
        switch (menuid) {
            case 1: 
                menu = buildMenu(filt.getAvailableFields(rowId, m), 1, 5, "drop");
                break;
            case 2:
                menu = buildMenu(filt.getAvailableDays  (rowId, m), 2, 5, "check");
                break;
            case 3:
                menu = buildMenu(filt.getAvailableTimes (rowId, m), 3, 5, "drop");
                break;
            default:
        }

        return menu;
        
        //m.addMenu(filt.getAvailableDates(), 7, "drop");
    }
}
